package cn.laike.modules.dev.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import cn.laike.common.utils.PageUtils;
import cn.laike.common.utils.Query;

import cn.laike.modules.dev.dao.HotelRoomDao;
import cn.laike.modules.dev.entity.HotelRoomEntity;
import cn.laike.modules.dev.service.HotelRoomService;
import cn.laike.modules.sys.shiro.ShiroUtils;


@Service("hotelRoomService")
public class HotelRoomServiceImpl extends ServiceImpl<HotelRoomDao, HotelRoomEntity> implements HotelRoomService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
    	//酒店ID
    	String hotelId = (String)params.get("hotelId");	
        Page<HotelRoomEntity> page = this.selectPage(
                new Query<HotelRoomEntity>(params).getPage(),
                new EntityWrapper<HotelRoomEntity>()
                .eq(ShiroUtils.isAdmin(),"uid", ShiroUtils.getUserId())
                .eq(StringUtils.isNotBlank(hotelId),"hotel_id", hotelId)   
                .eq("del_flag", "0")
                .orderBy("sort", false)
        );

        return new PageUtils(page);
    }

	@Override
	public List<HotelRoomEntity> queryHotelRoomList(Integer hotelId, Integer days,String isStock) {
		return baseMapper.queryHotelRoomList(hotelId, days,isStock);
	}

	@Override
	public List queryHotelRoomNameList(Integer hotelId) {
		return baseMapper.queryHotelRoomNameList(hotelId);
	}


    
  
}
